#include <iostream>
#include <fstream>

using namespace std;


struct Character
{
	char name[256];
	int age;
	int experience;
};

int main( void )
{

	Character character, readChar;
	strcpy( character.name, "Brent" );
	character.age = 23;
	character.experience = -1;

	//ofstream myfile( "ourfile.txt", ios_base::out | ios::binary );

	//myfile.open( );

	//if ( myfile.is_open() )
	//{
	//	myfile<<character.name<<endl;
	//	myfile<<character.age<<endl;
	//	myfile<<character.experience<<endl;
	//	myfile << "\nnew text";
	//	int n = 456;
	//	myfile.write( (char*)&n, sizeof(int));
	////	myfile.write( (char*)&character, sizeof(character));
	//}

	//myfile.close();

	ifstream iFile( "ourfile.txt", ios::in | ios::binary );
	//iFile.seekg(7);
	//iFile.seekg( -7, ios::end );

	if ( iFile.is_open() )
	{
		while ( iFile.good() )
		{
			char buffer[256];
			int n;

			iFile.read( (char*)&character, sizeof(character) );

			iFile.getline( buffer, 256 );
			cout << buffer << endl;

			int x = 0;
		}
			iFile.close();

	}
	else
		cout << "Unable to open file.";

	return 0;

}